package de.tingwang.test;

import java.util.Properties;

import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.teneo.hibernate.HbDataStore;
import org.eclipse.emf.teneo.hibernate.HbHelper;

import  org.open.oasis.docs.wsbpel._2._0.plnktype.*;
import org.open.oasis.docs.wsbpel._2._0.process.executable.ExecutablePackage;
import org.open.oasis.docs.wsbpel._2._0.serviceref.ServicerefPackage;
import org.open.oasis.docs.wsbpel._2._0.varprop.VarpropPackage;

public class initDatabase {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		final String dataStoreName = "PurchaseOrderDataStore";
		final HbDataStore dataStore = HbHelper.INSTANCE.createRegisterDataStore(dataStoreName);
		Properties props = new Properties();
		props.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
		props.setProperty("hibernate.connection.url", "jdbc:mysql://localhost/bpel2");
		props.setProperty("hibernate.connection.username", "root");
		props.setProperty("hibernate.connection.password", "");
		props.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
		dataStore.setProperties(props);
//		dataStore.setEPackages(new EPackage[] {PlnktypePackage.eINSTANCE});
//		dataStore.setEPackages(new EPackage[] {ExecutablePackage.eINSTANCE});
//		dataStore.setEPackages(new EPackage[] {ServicerefPackage.eINSTANCE});
		dataStore.setEPackages(new EPackage[] {VarpropPackage.eINSTANCE});
		dataStore.initialize();
		System.out.println("init finished");
	}

}
